const express = require('express');
const router = express.Router();
const CartController = require('../controllers/cartController');
const authMiddleware = require('../middlewares/authMiddleware');

// 获取购物车
router.get('/', authMiddleware, CartController.getCart);

// 添加到购物车
router.post('/', authMiddleware, CartController.addToCart);

// 更新购物车商品数量
router.put('/:id', authMiddleware, CartController.updateCartItem);

// 从购物车移除
router.delete('/:id', authMiddleware, CartController.removeFromCart);

// 清空购物车
router.delete('/', authMiddleware, CartController.clearCart);

module.exports = router;